Skip to content

fix(ci): avoid pipefail in ci.yaml shell code - #2462

Open
juenglin wants to merge 1 commit into
NVIDIA:mainfrom
juenglin:ci-shell-issue
Open

fix(ci): avoid pipefail in ci.yaml shell code#2462
juenglin wants to merge 1 commit into
NVIDIA:mainfrom
juenglin:ci-shell-issue

Conversation

@juenglin

@juenglin juenglin commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Issue: ci failures like this

The CI failure is a classic SIGPIPE + pipefail interaction.

The original code pipes gh api --paginate into head -1. Under bash -o pipefail
(set by the shell option in the step), when head -1 reads one line and exits, it
closes the pipe. gh api then receives SIGPIPE (exit 141), and pipefail propagates
that non-zero exit code through the command substitution, causing the step to fail
under set -e.

The fix avoids this by:

  1. Collecting all output into an array via mapfile (no pipe to break).
  2. Using || true to suppress any transient gh api exit code from the process substitution.
  3. Taking the first element with ${_tags[0]:-} instead of head -1.

@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the CI/CD CI/CD infrastructure label Jul 30, 2026
@juenglin
juenglin requested a review from mdboom July 30, 2026 22:54
@juenglin juenglin added the bug Something isn't working label Jul 30, 2026
@juenglin juenglin self-assigned this Jul 30, 2026
@juenglin juenglin added this to the cuda.core next milestone Jul 30, 2026

@kkraus14 kkraus14 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small inline notes.

Comment thread .github/workflows/ci.yml
--jq '.[] | select(.name | startswith("cuda-core-v")) | .name' \
| head -1)"
mapfile -t _tags < <(gh api "repos/$GITHUB_REPOSITORY/tags" --paginate \
--jq '.[] | select(.name | startswith("cuda-core-v")) | .name' || true)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| true masks every gh api failure, and mapfile cannot propagate a process-substitution status. A later pagination failure can therefore let this job continue after selecting a partial result. Please capture the command output normally before taking its first line.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested shape:

tags="$(gh api "repos/$GITHUB_REPOSITORY/tags" --paginate \
  --jq '.[] | select(.name | startswith("cuda-core-v")) | .name')"
tag="${tags%%$'\n'*}"

This consumes the output before selecting the first tag, avoids SIGPIPE, and keeps a gh api failure fatal under -e.

Comment thread .github/workflows/ci.yml
@@ -257,9 +257,9 @@ jobs:
# --paginate fetches all pages; jq outputs one name per line per page;
# head -1 takes the first (newest) match since GitHub returns tags

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment still says head -1 selects the tag. Please update it to describe selecting the first collected tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CI/CD CI/CD infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants